package cn.myschool.test;

import cn.myschool.dao.SubjectDao;
import cn.myschool.entity.Subject;
import cn.myschool.util.MybatisUtil;
import org.apache.ibatis.session.SqlSession;

/**
 * @author oldliu
 * @since 1.0
 */
public class AddSubject {
    public static void main(String[] args) {
        SqlSession s= MybatisUtil.get();
        Subject subject=new Subject("新能源车维修",100,7);
        SubjectDao mapper = s.getMapper(SubjectDao.class);
        int res = mapper.add(subject);
        System.out.println("增加了"+res+"条");
        System.out.println("新课程的编号："+subject.getId());
        s.commit();
        MybatisUtil.close(s);
    }
}
